//
//  RCAttendUserCell.m
//  RocketProject
//
//  Created by chen jiedan on 13-9-29.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "RCAttendUserCell.h"
#import "CommonDefines.h"
#import "UIColor-Expanded.h"
#import "UIImageView+Extented.h"

#define kBGImageFile            @"image_discount_cell_bg.png"

@implementation RCAttendUserCell{
    UILabel *_nameLabel;
    UILabel *_dateTimeLabel;
    UILabel *_phoneLabel;
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        
        UIImage *bgImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:kBGImageFile ofType:nil]];
        [self setBackgroundColorWithImage:bgImage];
        self.backgroundColor = [UIColor clearColor];
        
        [self createPlaceHolder];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (void) createPlaceHolder
{
    _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 15, 280, 15)];
    [self.contentView addSubview:_nameLabel];
    _nameLabel.font = [UIFont fontWithName:kFontNameHeiti size:15];
    _nameLabel.textColor = kNormalOrangeTextColor;
    [_nameLabel setBackgroundColor:[UIColor clearColor]];
    [_nameLabel release];
    

    
    _dateTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(180, 15, 120, 15)];
    [self.contentView addSubview:_dateTimeLabel];
    _dateTimeLabel.font = [UIFont fontWithName:kFontNameHeiti size:15];
    _dateTimeLabel.textColor = kNormalHeadTextColor;
    [_dateTimeLabel setBackgroundColor:[UIColor clearColor]];
    [_dateTimeLabel release];
    
    
    _phoneLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 40, 185, 15)];
    [self.contentView addSubview:_phoneLabel];
    _phoneLabel.font = [UIFont fontWithName:kFontNameHeiti size:15];
    _phoneLabel.textColor = kNormalTextColor;
    [_phoneLabel setBackgroundColor:[UIColor clearColor]];
    [_phoneLabel release];
    
    UIImageView *indicator = [[UIImageView alloc] initWithFrame:CGRectMake(290, 40, 20, 20)];
    [indicator autoResizeToSetImage:[UIImage imageNamed:@"icon_RCUserVC_indicate"]];
    [self.contentView addSubview:indicator];
    [indicator release];
    
    
    UIImageView *horizonLine = [[UIImageView alloc]initWithFrame:CGRectMake(0, 69, 320, 1)];
    horizonLine.backgroundColor = [UIColor clearColor];
    [horizonLine setImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image_line_type3.png" ofType:nil]]];
    [self.contentView addSubview:horizonLine];
    [horizonLine release];
}

- (void) bindData:(RCAttendPersonItemDataModel *)item
{
    _nameLabel.text = [NSString stringWithFormat:@"姓名：%@",item.title];
    _dateTimeLabel.text = item.dateTime;
    _phoneLabel.text = [NSString stringWithFormat:@"预订电话：%@",item.phone];
    
}

@end
